10 REM                   Smart Digital Clock
11 REM
12 REM           by: Dale Dewey
13 REM               Eastman Kodak Company
14 REM
100 REM  Define screen fundamental strings
110 REM
120 BSLF$=CHR$(29)+CHR$(31)
130 HL$=CHR$(205)+CHR$(205)+CHR$(205)
140 VL$=CHR$(186)+BSLF$+CHR$(186)+BSLF$
150 US5$=CHR$(30)+CHR$(30)+CHR$(30)+CHR$(30)+CHR$(30)
160 US3$=LEFT$(US5$,3)
170 BS4$=CHR$(29)+CHR$(29)+CHR$(29)+CHR$(29)
200 REM
210 REM Start of main program
220 REM
230 CLS:WIDTH 80:KEY OFF
240 REM
250 REM Set the time if necessary
260 REM
270 PRINT "Do you wish to set the time? => ";
280 A$=INKEY$
290 IF LEN(A$)<>1 THEN A$="":GOTO 280
300 PRINT
310 IF LEFT$(A$,1)="y" THEN GOSUB 1530
320 IF LEFT$(A$,1)="Y" THEN GOSUB 1530
330 T$=TIME$
500 REM
510 REM Display the time
520 REM
530 CLS
540 REM
550 REM Draw the box
560 REM
570 LOCATE 6,20
580 FOR I=1 TO 39:PRINT CHR$(223);:NEXT I:PRINT
590 LOCATE 6,19
600 FOR I=1 TO 11:PRINT CHR$(222);BSLF$;:NEXT I:PRINT
610 LOCATE 6,59
620 FOR I=1 TO 11:PRINT CHR$(221);BSLF$;:NEXT I:PRINT
630 LOCATE 16,20
640 FOR I=1 TO 39:PRINT CHR$(220);:NEXT I:PRINT
650 REM
660 REM Draw the digits
670 REM
680 X=8:Y=25:Z=VAL(LEFT$(T$,1))
690 GOSUB 1030
700 Y=32:Z=VAL(MID$(T$,2,1))
710 GOSUB 1030
720 Y=39:Z=10:COLOR 23
730 GOSUB 1030
740 Y=42:Z=VAL(MID$(T$,4,1)):COLOR 7
750 GOSUB 1030
760 Y=49:Z=VAL(MID$(T$,5,1))
770 GOSUB 1030
780 REM
790 REM Wait for the minutes to change
800 REM
810 WHILE MID$(T$,5,1)=MID$(TIME$,5,1):WEND
820 T$=TIME$
830 GOTO 530
1000 REM
1010 REM Locate the digit and print the number
1020 REM
1030 LOCATE X,Y:ON Z+1 GOSUB 1140,1150,1160,1170,1180,1190,1200,1210,1220,1230,1240:RETURN
1100 REM
1110 REM Print strings for each digit. Value of Z in statement 1030 picks digit
1120 REM        to be printed.  If Z=2 then a '2' is printed.
1130 REM
1140 PRINT CHR$(201);HL$;CHR$(187);BSLF$;VL$;VL$;CHR$(186);BSLF$;BS4$;US5$;VL$;VL$;CHR$(186);BSLF$;CHR$(200);HL$;CHR$(188):RETURN
1150 PRINT " ";CHR$(213);CHR$(187);BSLF$;VL$;VL$;CHR$(186);BSLF$;CHR$(29);CHR$(29);CHR$(212);CHR$(205);CHR$(202);CHR$(205);CHR$(190):RETURN
1160 PRINT CHR$(213);HL$;CHR$(187);BSLF$;VL$;BS4$;CHR$(201);HL$;CHR$(188);BSLF$;BS4$;VL$;CHR$(200);HL$;CHR$(190):RETURN
1170 PRINT CHR$(213);HL$;CHR$(187);BSLF$;VL$;BS4$;CHR$(198);HL$;CHR$(185);BSLF$;VL$;BS4$;CHR$(212);HL$;CHR$(188):RETURN
1180 PRINT CHR$(210);BSLF$;VL$;CHR$(200);HL$;CHR$(185);CHR$(29);US3$;CHR$(210);BSLF$;VL$;CHR$(31);VL$;CHR$(208):RETURN
1190 PRINT CHR$(201);HL$;CHR$(184);BSLF$;BS4$;VL$;CHR$(200);HL$;CHR$(187);BSLF$;VL$;BS4$;CHR$(212);HL$;CHR$(188):RETURN
1200 PRINT CHR$(201);HL$;CHR$(184);BSLF$;BS4$;VL$;CHR$(200);HL$;CHR$(187);BSLF$;VL$;BS4$;CHR$(212);HL$;CHR$(188);US3$;CHR$(29);BS4$;CHR$(204);BSLF$;VL$;CHR$(200):RETURN
1210 PRINT CHR$(213);HL$;CHR$(187);BSLF$;VL$;VL$;CHR$(186);BSLF$;CHR$(208):RETURN
1220 PRINT CHR$(201);HL$;CHR$(187);BSLF$;VL$;VL$;CHR$(186);BSLF$;BS4$;US5$;VL$;VL$;CHR$(186);BSLF$;CHR$(200);HL$;CHR$(188);US3$;CHR$(29);BS4$;CHR$(204);HL$;CHR$(185):RETURN
1230 PRINT CHR$(210);BSLF$;VL$;CHR$(200);HL$;CHR$(185);CHR$(29);US3$;CHR$(210);BSLF$;VL$;CHR$(31);VL$;CHR$(208);US3$;US3$;CHR$(29);BS4$;CHR$(201);HL$;CHR$(187):RETURN
1240 PRINT  " ";BSLF$;CHR$(2);BSLF$;CHR$(31);CHR$(31);CHR$(2):RETURN
1500 REM
1510 REM Set the time
1520 REM
1530 INPUT "Enter the HOUR => ",H$
1540 IF LEN(H$)=1 THEN 1550 ELSE H$=LEFT$(H$,2)
1550 INPUT "Enter the MINUTES => ",M$
1560 IF LEN(M$)=1 THEN 1570 ELSE M$=LEFT$(M$,2)
1570 INPUT "Enter the SECONDS => ",S$
1580 IF LEN(S$)=0 THEN S$="0"
1590 IF LEN(S$)=1 THEN S$="0"+S$ ELSE S$=LEFT$(S$,2)
1600 TIME$=H$+":"+M$+":"+S$
1610 T$=TIME$
1620 RETURN
